<%@ page import="com.hf.constant.OrderLunchConst"%>
<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="mainUser">
<title>Admin Operaton</title>
</head>
<body>
	<div id="container">
		<h2>Admin Operaton:</h2>

		<table id="hor-minimalist">
			<thead>
				<tr>
					<th scope="col">No.</th>
					<th scope="col">Description</th>
					<th scope="col">Operation</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>1</td>
					<td>Send Order Lunch Mail Manually</td>
					<td><input type="button" class="btn" id="sendMail"
						value="Send Mail" /></td>
				</tr>
				<tr>
					<td>2</td>
					<td>is Rain Day</td>
					<td><g:checkBox name="isRainDay" /> <br /> <input
						type="button" class="btn" id="updateRainDay" value="update" /></td>
				</tr>
				<tr>
					<td>3</td>
					<td>Bill Day of Period</td>
					<td><g:field name="billDay" type="text"
							value="${command?.billDay}" /> <br /> <input
						type="button" class="btn" id="updateBillDay" value="update" /></td>
					</td>
				</tr>
		</table>
	</div>
	<jq:jquery>
	    $('#isRainDay').prop('checked', ${command?.isRainday});
	
		$('#sendMail').click(function(e){
			e.preventDefault();
			if (!confirm('Are you sure?')) {
				return;
			}
			$.ajax({
				type:'POST',
				url: '/orderLunch/adminOperation/sendOrderMail',
				success:function(result){
					alert('Send mail ok!');
				}
			});
		});
		
		$('#updateRainDay').click(function(e){
			e.preventDefault();
			var data = {'isRainDay':$('#isRainDay').is(':checked')};
			$.ajax({
				type:'POST',
				url: '/orderLunch/adminOperation/updateRainDay',
				data: data,
				success:function(result){
					alert('Update rain day ok!');
				}
			});
		});

		$('#updateBillDay').click(function(e){
			e.preventDefault();
			var billDay = $('#billDay').val();
			var data = {'billDay':billDay};
			$.ajax({
				type:'POST',
				url: '/orderLunch/adminOperation/updateBillDay',
				data: data,
				success:function(result){
					alert('Update rain day ok!');
				}
			});
		});
	</jq:jquery>
</body>
</html>